<?php
/**
 * Created by PhpStorm.
 * User: linlin
 * Date: 2017/3/27
 * Time: 11:41
 */
namespace Home\Controller;
use Think\Controller;
class ProductController extends Controller{
    /*
     * CelebrationGrey zhoucong
    * 首页产品
     */
    public function productHomeShow(){
        $Product = M('orui_products');
        $result = $Product->order('product_datetime desc')->limit(2)->getField('product_id,product_name,product_img,product_content');
        var_dump($result);
    }

    public  function  productCenterShow(){
        $Product = M('orui_products');
        $result = $Product->order('product_datetime desc')->limit(4)->getField('product_id,product_name,product_img,product_content');
        var_dump($result);
    }

    public function productDetails(){
        $Product = M('orui_products');
        if($_GET){
            $product_id = I("get.product_id",'intval');
            $conditions['product_id'] = $product_id;
            $result = $Product->where($conditions)->select();
            $Product->where($conditions)->setInc('product_watch_count');
        }
        else{
            $conditions['product_id'] = 1;
            $result = $Product->where($conditions)->select();
            $Product->where($conditions)->setInc('product_watch_count');
        }
        var_dump($result);
    }
    /*
 * CelebrationGrey zhoucong
 *
 */
}